package javango.util;

public class Humanize {
	public static String humanize(String s) {
		if ((s == null) || (s.length() == 0)) {
			return s;
		}
		String string = s.replaceAll(
				String.format("%s|%s|%s",
						"(?<=[A-Z])(?=[A-Z][a-z])",
						"(?<=[^A-Z])(?=[A-Z])",
						"(?<=[A-Za-z])(?=[^A-Za-z])"
				),
				" "
		);
		return Character.toUpperCase(string.charAt(0)) + string.substring(1);
	}
}
